package 剑指offer;


/*
 * Author：江松
 * Date：2023/3/15 15:01

 左旋转字符串
 */

public class Main29 {
    public String LeftRotateString(String str,int n) {
        int len=str.length();
        if(len==0)return "";
        char[] ch=new char[len];
        int mv=n%len;
        for(int i=0;i<len;++i){
            char c=str.charAt(i);
            ch[(len-mv+i)%len]=c;
        }
        return new String(ch);
    }

    public static void main(String[] args) {
        System.out.println(new Main29().LeftRotateString("aab",10));
    }
}
